import React, { Component } from "react";
class UserList extends Component {
    state = {
        name: "zhangsan",
        age: 100
    }
    divRef = React.createRef();
    changeName = () => {
        console.log(this.divRef)
        this.setState(preState => {
            return {
                age: preState.age + 1
            }
        });
    }
    render() {
        return (
            <div ref={this.divRef}>
                <div>
                    {this.state.name}
                    {this.state.age}
                    <button onClick={this.changeName}>click</button>
                </div>
                <ul>
                    <li>{this.props.name}</li>
                    <li>{this.props.age}</li>
                    <li>{this.props.address}</li>
                </ul>
            </div>
        )
    }
}
export default UserList;